/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package homework6;

/**
 *
 * @author Administrator
 */
import java.util.*;

public class MainH2 {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        int count = 0;
        if (a.length() < 9) {
            System.out.println(0);
        } else {
            for (int i = 0; i < a.length() - 8; i++) {
                if (a.substring(i, i + 9).equals("guangming")) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
